package com.nbsaas.boot.project.rest.resource;

import com.nbsaas.boot.project.api.apis.DataModelApi;
import com.nbsaas.boot.project.data.entity.DataModel;
import com.nbsaas.boot.project.api.domain.request.DataModelRequest;
import com.nbsaas.boot.project.api.domain.response.DataModelResponse;
import com.nbsaas.boot.project.api.domain.simple.DataModelSimple;
import com.nbsaas.boot.project.rest.convert.DataModelSimpleConvert;
import com.nbsaas.boot.project.rest.convert.DataModelEntityConvert;
import com.nbsaas.boot.project.rest.convert.DataModelResponseConvert;
import com.nbsaas.boot.project.data.repository.DataModelRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   业务接口实现
*/
@Transactional
@Service
public class DataModelResource extends BaseResource<DataModel,DataModelResponse, DataModelSimple, DataModelRequest>  implements DataModelApi {

    @Resource
    private DataModelRepository dataModelRepository;

    @Override
    public JpaRepositoryImplementation<DataModel, Serializable> getJpaRepository() {
        return dataModelRepository;
    }

    @Override
    public Function<DataModel, DataModelSimple> getConvertSimple() {
        return new DataModelSimpleConvert();
    }

    @Override
    public Function<DataModelRequest, DataModel> getConvertForm() {
        return new DataModelEntityConvert();
    }

    @Override
    public Function<DataModel, DataModelResponse> getConvertResponse() {
        return new DataModelResponseConvert();
    }




}


